import request from '@/utils/request'
// 得到列表
export const getRightList = () => {
  return request({
    method: 'GET',
    url: '/rights/list'
  })
}
// 删除数据
export const delJiaoseId = (roleId, perId) => {
  return request({
    method: 'DELETE',
    url: `/roles/${roleId}/rights/${perId}`
  })
}
// 获取当前一行用户的信息
export const getOneroles = (perId) => {
  return request({
    method: 'GET',
    url: `/roles/${perId}`
  })
}
// 修改用户信息
export const editOneroles = (perId, data) => {
  return request({
    method: 'PUT',
    url: `/roles/${perId}`,
    data
  })
}
// 添加用户
export const addUser = (data) => {
  return request({
    method: 'POST',
    url: '/roles',
    data
  })
}
// 删除用户
export const delOneUser = (perId) => {
  return request({
    method: 'DELETE',
    url: `/roles/${perId}`
  })
}
// 获取-权限列表-树形结构
export const getTrees = () => {
  return request({
    method: 'GET',
    url: '/rights/tree'
  })
}
// 角色分配-权限点
export const editTrees = (roleId, str) => {
  return request({
    method: 'POST',
    url: `/roles/${roleId}/rights`,
    data: {
      rids: str
    }
  })
}
